<template>
  <div>
    <table border="1">
      <thead>
        <tr>
          <th v-for="item in tablename">{{item}}</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="item in tabledata">
            <td v-for="data in item">{{data}}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
export default {
  name: "tablecomponent",
  props: ["tabledata"],
  mounted() {
    for (var item in this.tabledata[0]) {
      this.tablename.push(item);
    }
  },
  data() {
    return {
      //data
      tablename: [],
      tabledata: this.tabledata
    };
  }
};
</script>